﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace EX_NFC.FrontEnd.Windows.Converters
{
    /// <summary>
    /// Bool to its opposite visibility converter
    /// </summary>
    /// <remarks></remarks>
    public class OppositeBoolToVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool)
            {
                return (bool)value ? Visibility.Collapsed : Visibility.Visible;
            }

            return Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is Visibility)
            {
                var visibility = (Visibility)value;

                return visibility != Visibility.Visible;
            }

            return false;
        }
    }
}
